package com.geeke.sys.entity;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.geeke.common.persistence.DataEntity;
import java.util.*;

/**
 * 安全配置表Entity
 * 
 * ⚠️ 重要说明：
 *   如果表中包含`name`或`remarks`字段，必须在实体类中显式定义`name`或`remarks`属性。
 *   这些字段的属性已经包含在基类中，无需在实体类定义：`id`, `createBy`, `createDate`, `updateBy`, `updateDate`, `delFlag`, `parent`, `ids`, `sort`
 */
public class Security extends DataEntity<Security> {

    private static final long serialVersionUID = 1L;
    
    public Security() {
        super();
    }
    
    public Security(String id) {
        super(id);
    }

    @NotBlank(message = "是否完成第一次配置不能为空")
    @Length(min = 1, max = 1, message = "是否完成第一次配置长度必须为1")
    private String configFlag = "0"; // 是否完成第一次配置
    
    @NotNull(message = "最小长度不能为空")
    @Range(min = 1, max = 100, message = "最小长度必须介于1和100之间")
    private Integer minLength = 8; // 最小长度
    
    @NotBlank(message = "是否包含字母不能为空")
    @Length(min = 1, max = 1, message = "是否包含字母长度必须为1")
    private String includeLetter = "1"; // 是否包含字母
    
    @NotBlank(message = "是否包含数字不能为空")
    @Length(min = 1, max = 1, message = "是否包含数字长度必须为1")
    private String includeNumeral = "1"; // 是否包含数字
    
    @NotBlank(message = "是否包含特殊字符不能为空")
    @Length(min = 1, max = 1, message = "是否包含特殊字符长度必须为1")
    private String includeSpecial = "0"; // 是否包含特殊字符
    
    @NotBlank(message = "首次登录更换密码不能为空")
    @Length(min = 1, max = 1, message = "首次登录更换密码长度必须为1")
    private String changeFirst = "1"; // 首次登录更换密码
    
    @NotNull(message = "登录失败次数后锁定不能为空")
    @Range(min = 1, max = 100, message = "登录失败次数后锁定必须介于1和100之间")
    private Integer tryCount = 10; // 登录失败次数后锁定
    
    @NotNull(message = "自动解锁分钟不能为空")
    @Range(min = 1, max = 1440, message = "自动解锁分钟必须介于1和1440之间")
    private Integer unlockTime = 30; // 自动解锁分钟
    
    @NotBlank(message = "密码可以与之前的相同不能为空")
    @Length(min = 1, max = 1, message = "密码可以与之前的相同长度必须为1")
    private String allowLast = "0"; // 密码可以与之前的相同
    
    @NotNull(message = "密码过期月数不能为空")
    @Range(min = 1, max = 36, message = "密码过期月数必须介于1和36之间")
    private Integer expire = 3; // 密码过期月数
    
    @NotNull(message = "密码更新提醒天数不能为空")
    @Range(min = 1, max = 90, message = "密码更新提醒天数必须介于1和90之间")
    private Integer warnDay = 30; // 密码更新提醒天数
    
    @NotBlank(message = "安全水印不能为空")
    @Length(min = 1, max = 1, message = "安全水印长度必须为1")
    private String watermark = "0"; // 安全水印
    
    @NotBlank(message = "传输加密不能为空")
    @Length(min = 1, max = 1, message = "传输加密长度必须为1")
    private String cryptoFlag = "1"; // 传输加密
    
    @NotBlank(message = "加密IV不能为空")
    @Length(min = 1, max = 16, message = "加密IV长度必须介于1和16之间")
    private String cryptoIv = "1234567890000000"; // 加密IV

    public String getConfigFlag() {
        return configFlag;
    }

    public void setConfigFlag(String configFlag) {
        this.configFlag = configFlag;
    }

    public Integer getMinLength() {
        return minLength;
    }

    public void setMinLength(Integer minLength) {
        this.minLength = minLength;
    }

    public String getIncludeLetter() {
        return includeLetter;
    }

    public void setIncludeLetter(String includeLetter) {
        this.includeLetter = includeLetter;
    }

    public String getIncludeNumeral() {
        return includeNumeral;
    }

    public void setIncludeNumeral(String includeNumeral) {
        this.includeNumeral = includeNumeral;
    }

    public String getIncludeSpecial() {
        return includeSpecial;
    }

    public void setIncludeSpecial(String includeSpecial) {
        this.includeSpecial = includeSpecial;
    }

    public String getChangeFirst() {
        return changeFirst;
    }

    public void setChangeFirst(String changeFirst) {
        this.changeFirst = changeFirst;
    }

    public Integer getTryCount() {
        return tryCount;
    }

    public void setTryCount(Integer tryCount) {
        this.tryCount = tryCount;
    }

    public Integer getUnlockTime() {
        return unlockTime;
    }

    public void setUnlockTime(Integer unlockTime) {
        this.unlockTime = unlockTime;
    }

    public String getAllowLast() {
        return allowLast;
    }

    public void setAllowLast(String allowLast) {
        this.allowLast = allowLast;
    }

    public Integer getExpire() {
        return expire;
    }

    public void setExpire(Integer expire) {
        this.expire = expire;
    }

    public Integer getWarnDay() {
        return warnDay;
    }

    public void setWarnDay(Integer warnDay) {
        this.warnDay = warnDay;
    }

    public String getWatermark() {
        return watermark;
    }

    public void setWatermark(String watermark) {
        this.watermark = watermark;
    }

    public String getCryptoFlag() {
        return cryptoFlag;
    }

    public void setCryptoFlag(String cryptoFlag) {
        this.cryptoFlag = cryptoFlag;
    }

    public String getCryptoIv() {
        return cryptoIv;
    }

    public void setCryptoIv(String cryptoIv) {
        this.cryptoIv = cryptoIv;
    }

    @Override
    public String getTableAlias() {
        return "security";
    }
} 